﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage/Home.Master" AutoEventWireup="true" CodeBehind="CateDetail.aspx.cs" Inherits="TTMarketing.Admin.CateDetail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHeader" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceMain" runat="server">
<asp:Panel ID="plContent" runat="server">
        <div id="close">
            <table width="100%">
                <tr>
                    <td>
                        <asp:Label ID="lblTitle" runat="server" Style="font-size: 30px" 
                            Text="Thông tin chi tiết sản phẩm theo loại"></asp:Label>
                    </td>
                    <td align="right" width="100px">
                        <asp:Label ID="lblStt" runat="server" Text="Trạng thái "></asp:Label>
                        <telerik:RadComboBox ID="cmbClose" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbClose_SelectedIndexChanged"
                            Width="100px">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Text="Close" Value="0" />
                                <telerik:RadComboBoxItem runat="server" Text="Open" Value="1" />
                            </Items>
                        </telerik:RadComboBox>
                    </td>
                </tr>
            </table>
        </div>
        <div id="divmessage2" runat="server">
        </div>
        <asp:Panel ID="plDetail" runat="server" Width="100%">
        <div id="divmessage" runat="server">
            </div>
            <fieldset>
                <legend>Thông tin chi tiết sản phẩm của loại</legend>
                <table width="100%">
                    <tr>
                        <td width="200px">
                            <asp:Label ID="lblFactoryName0" runat="server" Text="Tên thể loại sản phẩm"></asp:Label>
                            <asp:ObjectDataSource ID="odsType" runat="server" SelectMethod="getStatus" 
                                TypeName="TTBusiness.ClassDB.clsBSTypeProduct">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="true" Name="status" Type="Boolean" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        </td>
                        <td>
                            <telerik:RadComboBox ID="cmbType" runat="server" AutoPostBack="True" 
                                DataSourceID="odsType" DataTextField="Name" DataValueField="ID" 
                                Width="100%" ondatabound="cmbType_DataBound" 
                                onselectedindexchanged="cmbType_SelectedIndexChanged">
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td width="200px">
                            <asp:Label ID="lblFactoryName" runat="server" Text="Tên loại sản phẩm"></asp:Label>
                            <asp:ObjectDataSource ID="odsCate" runat="server" SelectMethod="getByType" 
                                TypeName="TTBusiness.ClassDB.clsBSCateProduct">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="true" Name="status" Type="Boolean" />
                                    <asp:ControlParameter ControlID="cmbType" DefaultValue="" Name="typeId" 
                                        PropertyName="SelectedValue" Type="Int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        </td>
                        <td>
                            <telerik:RadComboBox ID="cmbCate" runat="server" AutoPostBack="True" 
                                DataSourceID="odsCate" DataTextField="Name" DataValueField="ID" 
                                ondatabound="cmbCate_DataBound" 
                                onselectedindexchanged="cmbCate_SelectedIndexChanged" Width="100%">
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblOrderRequest" runat="server" Text="Tên thông tin chi tiết"></asp:Label>
                            <asp:ObjectDataSource ID="odsDetail" runat="server" SelectMethod="getAllNotInCate"
                                TypeName="TTBusiness.ClassDB.clsBSDetail">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="cmbCate" Name="cateId" PropertyName="SelectedValue"
                                        Type="Int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        </td>
                        <td>
                            <telerik:RadComboBox ID="cmbDetail" runat="server" Width="100%" DataSourceID="odsDetail"
                                DataTextField="Name" DataValueField="ID">
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblOrderRequest0" runat="server" Text="Số hiệu"></asp:Label>
                        </td>
                        <td>
                            <telerik:RadComboBox ID="cmbNumber" runat="server" 
                                DataTextField="Name" DataValueField="ID">
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Text="1" Value="1" />
                                    <telerik:RadComboBoxItem runat="server" Text="2" Value="2" />
                                    <telerik:RadComboBoxItem runat="server" Text="3" Value="3" />
                                    <telerik:RadComboBoxItem runat="server" Text="4" Value="4" />
                                    <telerik:RadComboBoxItem runat="server" Text="5" Value="5" />
                                    <telerik:RadComboBoxItem runat="server" Text="6" Value="6" />
                                    <telerik:RadComboBoxItem runat="server" Text="7" Value="7" />
                                    <telerik:RadComboBoxItem runat="server" Text="8" Value="8" />
                                    <telerik:RadComboBoxItem runat="server" Text="9" Value="9" />
                                    <telerik:RadComboBoxItem runat="server" Text="10" Value="10" />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button ID="btnSave" runat="server" Text="Thêm" onclick="btnSave_Click" />
                            &nbsp;
                            <asp:Button ID="btnClear" runat="server" Text="Đóng" />
                        </td>
                    </tr>
                </table>
                <br />
                <asp:HiddenField ID="hfId" runat="server" />
                <br />
            </fieldset>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" Width="100%">
            <telerik:RadGrid ID="rgdGrid" runat="server" AllowPaging="True" AllowSorting="True"
                DataSourceID="odsCateDetail" GridLines="None" ShowFooter="True" 
                onitemcommand="rgdGrid_ItemCommand">
                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" 
                    EnableRowHoverStyle="True">
                    <Selecting AllowRowSelect="True" />
                </ClientSettings>
                <MasterTableView AutoGenerateColumns="False" DataSourceID="odsCateDetail">
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" SortExpression="ID"
                            UniqueName="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="tblCateProduct.tblTypeProduct.Name" DataType="System.String"
                            HeaderText="Tên thể loại sản phẩm" SortExpression="tblCateProduct.tblTypeProduct.Name" 
                            UniqueName="TypeName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="tblCateProduct.Name" DataType="System.String"
                            HeaderText="Tên loại sản phẩm" SortExpression="tblCateProduct.Name" UniqueName="CateName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="tblDetail.Name" DataType="System.String"
                            HeaderText="Tên thông tin chi tiết" SortExpression="tblDetail.Name" 
                            UniqueName="DetailName">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Action" UniqueName="TemplateColumn">
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Admin/Images/Button/Delete_Grid.gif"
                                    CommandArgument='<%# Eval("ID") %>' CommandName="delete" OnClientClick=" return confirm(&quot;Bạn có chắc chắn muốn xóa?&quot;);" />
                            </ItemTemplate>
                            <ItemStyle Width="40px" />
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
                <HeaderContextMenu EnableAutoScroll="True">
                </HeaderContextMenu>
            </telerik:RadGrid>
            <asp:ObjectDataSource ID="odsCateDetail" runat="server" 
                SelectMethod="getByCate" TypeName="TTBusiness.ClassDB.clsBSCateDetail">
                <SelectParameters>
                    <asp:ControlParameter ControlID="cmbCate" Name="cateId" 
                        PropertyName="SelectedValue" Type="Int32" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </asp:Panel>
    </asp:Panel>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" 
        EnableHistory="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSaveNew">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="cmbAttribute" />
                    
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgdGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="cmbClose" />
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="divmessage"  />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="cmbAttribute" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnReset">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnClear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbClose">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbCate">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid"  />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbType">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid"  />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
